import Vue from 'vue'
import VueRouter from 'vue-router'
import homeItme from './HomeItem/homeItem.js'
const home = () => import('@/views/Home/home.vue')
const login = () => import('@/views/login.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/home'
  },{
    path: '/login',
    name: 'login',
    meta: { requireAuth: true },// 添加该字段，表示进入这个路由是需要登录的
    // redirect: '/welcome',
    component: login,
  },{
    path: '/home',
    name: 'home',
    meta: { requireAuth: true },// 添加该字段，表示进入这个路由是需要登录的
    // redirect: '/welcome',
    component: home,
    children: [
      ...homeItme //首页
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
